package com.sp.study.model.entity;

/**
 * <h1>
 *
 * </h1>
 *
 * @author Sp
 * @date 2020/9/16 - 19:40
 * @since 2020/9/16 - 19:40 星期三 by Sp Sp287940@163.com
 */
public class Main {
    public static void main(String[] args) {
        // 定义一个maxSize为4的Book数组
        BookShelf bookShelf = new BookShelf(4);
        bookShelf.appendBook(new Book("A"));
        bookShelf.appendBook(new Book("B"));
        bookShelf.appendBook(new Book("C"));
        bookShelf.appendBook(new Book("D"));

        Iterator it = bookShelf.iterator();

        while (it.hasNext()){
            // 将object类型next转为Book类型
            Book book = (Book)it.next();
            System.out.println(book.getName());
        }

        bookShelf.appendBook(new Book("E"));

        Book book = (Book)it.next();
        System.out.println(book.getName());
    }
}
